how to implement pattern in c